<template>
  <div>
    <van-nav-bar @click-left="$router.go(-1)" title="收藏列表" left-arrow />
    <div>
      <van-card
        @click="toDetail(item.houseCode)"
        v-for="item in info"
        :key="item.houseCode"
        :price="item.price"
        :desc="item.desc"
        :title="item.title"
        thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
      >
        <template #tags>
          <van-tag plain type="danger">{{ item.tags[0] }}</van-tag>
        </template>
      </van-card>
    </div>
  </div>
</template>

<script>
import { getCollect } from '@/api/Homepage'
export default {
  name: 'collect',
  data () {
    return {
      info: {}
    }
  },
  async created () {
    const { body } = await getCollect()
    console.log(body)
    this.info = body
  },
  methods: {
    toDetail (id) {
      this.$router.push({
        name: 'Fhdetail',
        query: { id }
      })
    }
  }
}
</script>
